﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using haptic.src.engine.debug;
using haptic.src.engine.render;
using haptic.src.engine.scene.space;

namespace haptic.src.engine
{
    public class Layer
    {
        #region Edit
        public void AddEntity(Entity oEntity)
        {
            List<Entity> oEntities = m_oSpace.GetEntities();
            if (!oEntities.Exists(delegate(Entity oE) { return oEntity == oE; }))
                oEntities.Add(oEntity);
        }
        public void RemoveEntity(Entity oEntity)
        {
            List<Entity> oEntities = m_oSpace.GetEntities();
            oEntities.Remove(oEntity);
        }
        #endregion

        #region Draw
        public void Draw(Renderer oRenderer, GameTime oTime)
        {
            List<Entity> oEntities = m_oSpace.GetEntities();
            foreach (Entity oEntity in oEntities)
            {
                oEntity.Draw(oRenderer, oTime);
            }
        }
        public void DrawDebug(DebugRenderer oDebug, GameTime oTime)
        {
            List<Entity> oEntities = m_oSpace.GetEntities();
            foreach (Entity oEntity in oEntities)
            {
                oEntity.DrawDebug(oDebug, oTime);
            }
        }
        #endregion

        #region Attributes
        private ISpace m_oSpace = new SimpleSpace();
        public float m_fDepth = 0.0f;
        public int m_iId = 0;
        #endregion
    }
}
